<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>isPrime</title>
</head>

<body>
    质数是指在大于1的自然数中，除了1和它本身以外不再有其他因数的自然数。
    <p id="result"></p>
    <script>
        const isPrime = num => {
            const boundary = Math.floor(Math.sqrt(num));
            for (let i = 2; i <= boundary; i++) {
                if (num % i === 0) {
                    return false;
                }
            }
            return num >= 2;
        };
        document.getElementById('result').innerHTML = `11${isPrime(11) ? '' : '不'}是一个质数!`;
    </script>
</body>

</html>